//
//  XiangCeCollectionViewCell.m
//  QT
//
//  Created by 甘世清 on 2025/1/8.
//

#import "XiangCeCollectionViewCell.h"

@implementation XiangCeCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.layer.masksToBounds = YES;
        [self SQ_UIViewForSelfView];
    }
    return self;
}
/// 添加ui
-(void)SQ_UIViewForSelfView
{
    self.contentView.layer.borderWidth = 0.4;
    self.contentView.layer.borderColor = SQColor999999.CGColor;
    self.contentView.layer.cornerRadius = 10;
    self.contentView.layer.masksToBounds = YES;
    
    UIImageView * image = [[UIImageView alloc]init];
    image.image = SQGetImage(@"xiangji");
    image.contentMode = UIViewContentModeScaleAspectFit;
    [self.contentView addSubview:image];
    [image mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.centerY.equalTo(self.contentView);
        make.size.mas_equalTo(50);
    }];
    
    [self.contentView addSubview:self.headerView];
    [self.headerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView);
    }];
    
    
}
- (void)setModel:(PhotoModel *)model{
    _model = model;
    if (model.isAdd) {
        self.headerView.hidden = YES;
    } else {
        self.headerView.hidden = NO;
        [self.headerView sd_setImageWithURL:SQURLImage(@"https://saliao.qingtao.fun/files/saliao/ticket/IMG_8758.PNG") placeholderImage:SQGetImage(@"1")];
    }
}

- (UIImageView *)headerView{
    if (!_headerView) {
        _headerView = [[UIImageView alloc]init];
        _headerView.contentMode = UIViewContentModeScaleAspectFill;
        _headerView.clipsToBounds = YES;
        _headerView.layer.cornerRadius = 10;
        _headerView.layer.masksToBounds = YES;
    }
    return _headerView;
}

@end
